using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Runtime.InteropServices;
using System.Windows.Forms;
//using PDFLibNet;
using System.Text.RegularExpressions;

public partial class MyCustomModules_PreviewForm16 : System.Web.UI.UserControl
{
    string conn = System.Configuration.ConfigurationManager.AppSettings.Get("MSSQLConnectionString");
    Guid uguid;
    DataSet ds = new DataSet();


    protected void Page_Load(object sender, EventArgs e)
    {
        System.Data.SqlClient.SqlDataReader dr = mojoPortal.Data.SqlHelper.ExecuteReader
            (conn, CommandType.StoredProcedure, "usp_GetUserDetails",
            new System.Data.SqlClient.SqlParameter("@UserEmail", HttpContext.Current.User.Identity.Name.ToString()));
        if (dr.HasRows)
        {
            dr.Read();
            uguid = new Guid(dr["UserGuid"].ToString());
        }
        dr.Close();

        ds = mojoPortal.Data.SqlHelper.ExecuteDataset(
            conn, CommandType.StoredProcedure, "usp_GetMyDocumentList",
           new System.Data.SqlClient.SqlParameter("@UserGUID", uguid));
       
        dgDocuments.DataSource = ds.Tables[0];
        dgDocuments.DataBind();

        //dgDocuments.Width = this.Page.
    }

    public string GetDocumentName(object value)
    {
        string sDBPath = (string)value;
        string sTempFileName = sDBPath.Remove(0, sDBPath.LastIndexOf("/") + 1);
        return sTempFileName.Remove(0, sTempFileName.IndexOf("_") + 1);
    }

    public string GetDocumentLink(object value)
    {
        //sActualFileName.Length < 30 ? sActualFileName : sActualFileName.Substring(0, 30);
        return "~/" + (string)value;
    }

   
}